release-23.1: colexec: fix evaluation of the IN expression with INT2 and INT4 types #121955
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 1/1 commits from #121904.
/cc @cockroachdb/release
This commit fixes a possible incorrect result of evaluation of the IN expression where the left side is INT2 or INT4 type and the right side has integers outside of the range of the left side's type. We do so by upcasting the "filter" row to INT8. Note that we already do the appropriate upcast in the comparison function, so the incorrect results could only be produced due to the "filter row" no longer being sorted in case a value overflows.
Fixes: #102864.
Release note (bug fix): CockroachDB could previously incorrectly evaluate IN expressions that had INT2 or INT4 type on the left side and values outside of the range of the left side on the right side. The bug has been present since at least 21.1 and is now fixed.
Release justification: bug fix.